Ext.define('ES.controller.search.SearchController',{
	extend:'Ext.app.Controller',
	 views: [
        'search.SearchBox'
    ],
    requires:['ES.model.SearchResultModel', 'ES.store.SearchResultStore'],
    models:['SearchResultModel'],
    stores:['SearchResultStore'],
	init:function(){
		this.control({
            'searchbox > button': {
                click: this.searchButtonClicked
            }
        });
	},
	searchButtonClicked: function() {
        //alert(Ext.get('searchQuery').getValue());
        /*this.getSearchResultStoreStore().each(function(result){
        	alert(result.get('name'))
        })*/
        
        this.getSearchResultStoreStore().load(function(records, operation, success) {
		        // the operation object
		        // contains all of the details of the load operation
		        alert(records)
		    }
		);
    }
});